<form action="" method="post">
    <table border="1" cellspacing="0" cellpadding="0">
        <tr>
            <td>用户名：</td>
            <td><input type="text" name="username"></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input type="password" name="passwd"></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" name="sub" value="提交"></td>
        </tr>
    </table>
</form>
<?php
/**
 * User: lie
 * Date: 2020/12/4 10:36
 * Title: 对用户注册的密码进行加密和解密
 * Description:
 * Error:
 */

if ($_POST['sub']) {
    echo "经加密";
    echo "<hr>";
    $depasswd = base64_encode($_POST['passwd']);
    echo "用户名：".$_POST['username'].' 密码：'.$depasswd;
    echo "<br>";
    echo "经解密";
    echo "<hr>";
    echo "用户名：".$_POST['username'].' 密码：'.base64_decode($depasswd);
}